import React from 'react';
import { Form, Field ,Button} from 'react-vant';

let Login = (props) => {
  const [form] = Form.useForm();

  const onFinish = (values) => {
    console.log(values);
    if (values.username  == "123" && values.password == "123")  {
          localStorage.setItem("isLogin","true")
          props.history.push("/my")
    } else {
      localStorage.setItem("isLogin","flase")
    }
  };

  return (
    <Form onFinish={onFinish} form={form}  footer={
      <div style={{ margin: '16px 16px 0' }}>
        <Button round nativeType="submit" type="primary" block>
          提交
        </Button>
      </div>
    }>
      <Form.Item name="username" label="用户名">
        <Field />
      </Form.Item>
      <Form.Item name="password" label="密码">
        <Field />
      </Form.Item>
    </Form>
  );
};
export default Login